package day1;

/**
 * @author pacai
 * @version 1.0
 */
public class SumOfac {
    public static int sumOfFac(int n) {
        int ans = 1;
        int fac = 1;
        for (int i = 2; i <= n; i++) {
            fac *= i;
            ans += fac;
        }
        return ans;
    }

    public static void main(String[] args) {
        System.out.println(sumOfFac(5));
    }
}
